package com.concurrent.art.chapter4;

public class TimeOut {
    public synchronized Object get(long mills) throws InterruptedException {
        long future = System.currentTimeMillis() + mills;
        long remaining = mills;
        while (remaining > 0) {
            wait(remaining);
            remaining = future - System.currentTimeMillis();
        }
        return new Object();
    }
}
